﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>
    <%@include file="common/head.jsp" %>
</head>

<body>
<div id="wrapper">

    <%@include file="common/sidebar.jsp" %>

    <div id="page-wrapper">
        <div id="page-inner">
            <div class="row">
                <div class="col-md-12">
                    <h1 class="page-header">
                        用户管理
                        <small>user manage.</small>
                    </h1>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <!-- Advanced Tables -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            用户数据管理
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                    <thead>
                                    <tr>
                                        <th>用户名</th>
                                        <th>电话号码</th>
                                        <th>邮箱</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${pageInfo.list}" var="u">
                                        <tr class="odd gradeX">
                                            <td>${u.userName}</td>
                                            <td>${u.userPhone}</td>
                                            <td>${u.userEmail}</td>
                                            <td>
                                                <button type="button" class="btn btn-sm btn-primary" onclick="window.location.href='/userManage/getUser?userId=${u.userId}'">更 新</button>
                                                <button type="button" class="btn btn-sm btn-danger" onclick="delUserFun('${u.userId}')" data-toggle="modal" data-target="#deleteUserModal">删 除</button>
                                            </td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                                <!-- 分页信息 -->
                                <div class="row text-center">
                                    当前第：${pageInfo.pageNum }页，总共：${pageInfo.pages }页，总共：${pageInfo.total }条记录
                                    <nav aria-label="Page navigation">
                                        <ul class="pagination">
                                            <li><a href="/userManage/userList?pn=1">首页</a></li>
                                            <c:if test="${pageInfo.hasPreviousPage }">
                                                <li>
                                                    <a href="/userManage/userList?pn=${pageInfo.pageNum-1 }" aria-label="Previous">
                                                        <span aria-hidden="true">&laquo;</span>
                                                    </a>
                                                </li>
                                            </c:if>

                                            <c:forEach items="${pageInfo.navigatepageNums }" var="page_Num">
                                                <c:if test="${page_Num == pageInfo.pageNum }">
                                                    <li class="active"><a href="#">${page_Num }</a></li>
                                                </c:if>
                                                <c:if test="${page_Num != pageInfo.pageNum }">
                                                    <li><a href="/userManage/userList?pn=${page_Num }">${page_Num }</a></li>
                                                </c:if>
                                            </c:forEach>
                                            <c:if test="${pageInfo.hasNextPage }">
                                                <li>
                                                    <a href="/userManage/userList?pn=${pageInfo.pageNum+1}" aria-label="Next">
                                                        <span aria-hidden="true">&raquo;</span>
                                                    </a>
                                                </li>
                                            </c:if>
                                            <li><a href="/userManage/userList?pn=${pageInfo.pages}">末页</a></li>
                                        </ul>
                                    </nav>
                                    <!-- 分页条结束 -->
                                </div>
                            </div>

                        </div>
                    </div>
                    <!--End Advanced Tables -->
                </div>
            </div>
            <!-- /. ROW  -->
        </div>

        <%@include file="common/footer.jsp" %>

    </div>
    <!-- /. PAGE INNER  -->
</div>
<!-- /. PAGE WRAPPER  -->
</div>
<!-- /. WRAPPER  -->

<!-- Modal -->
<div class="modal fade" id="deleteUserModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">系统提示:</h4>
            </div>
            <div class="modal-body">
                1、本次操作将永久性删除该用户<br/>
                2、如果该用户注册的有商家，将会连商家信息一并删除，请谨慎操作
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关 闭</button>
                <button type="button" class="btn btn-danger" id="deleteUserBtn">删 除</button>
            </div>
        </div>
    </div>
</div>

<!-- JS Scripts-->
<%@include file="common/scripts.jsp" %>

</body>

</html>